
from django.contrib import admin
from import_export import resources
from weiboRecommendation.models import WeiboMessage
from import_export.admin import ImportExportModelAdmin
# Register your models here.
class MessageResource(resources.ModelResource):
    class Meta:
        model = WeiboMessage
        export_order = ('msg_author','author_main_page','msg_content','msg_time','msg_url','msg_review_cnt')

@admin.register(WeiboMessage) # 用注解在创建的管理员权限下注册这个类, 由此在后台管理系统中可以使用。
class MessageAdmin(ImportExportModelAdmin):
    list_display = ('msg_author','author_main_page','msg_content','msg_time','msg_url','msg_review_cnt') #导入csv的时候要按照这个顺序
    search_fields =('msg_author','author_main_page','msg_content','msg_time','msg_url','msg_review_cnt')
    resources_class = MessageResource
